package com.example.drug.controller;

import java.util.HashMap;

import javax.annotation.Resource;

import com.example.common.support.Result;
import com.example.drug.dto.req.GetUserInfoReq;
import com.example.drug.dto.req.GetWxInfoReq;
import com.example.drug.service.LoginService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(tags = "")
@RequestMapping("/api/Login")
public class LoginController {
    @Resource
    private LoginService loginService;
    
    @ApiOperation(value = "用户登录", notes = "用户登录")
    @PostMapping(value = "/getUserInfo")
    public Result<HashMap<String,Object>> GetUserInfo(@RequestBody GetUserInfoReq ph){
        return Result.success(loginService.GetUserInfo(ph));
    }

    @ApiOperation(value = "发送验证码", notes = "发送验证码")
    @PostMapping(value = "/GetUserTel")
    public Result<String> GetUserTel(@RequestBody GetUserInfoReq ph){
        return Result.success(loginService.GetUserTel(ph));
    }

    @ApiOperation(value = "微信小程序通过code换取openid和UID (正式）", notes = "微信小程序通过code换取openid和UID (正式）")
    @PostMapping(value = "/getWxInfoR")
    public Result<HashMap<String,Object>> getWxInfoR(@RequestBody GetUserInfoReq ph){
        return Result.success(loginService.getWxInfoR(ph));
    }

    @ApiOperation(value = "获取电话", notes = "获取电话")
    @PostMapping(value = "/GetUserTelR")
    public Result<HashMap<String,Object>> GetUserTelR(@RequestBody GetWxInfoReq ph){
        return Result.success(loginService.GetUserTelR(ph));
    }
    
}
